package edu.whu.puppygo.dao;

import edu.whu.puppygo.entity.GrowthRecord;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface GrowthRecordDao extends JpaRepository<GrowthRecord, Long>, JpaSpecificationExecutor<GrowthRecord> {
    @Query("select g from GrowthRecord g where g.petId = ?1 and g.recordMonth = ?2")
    List<GrowthRecord> findByPetIdAndRecordMonth(long petId, int recordMonth, Pageable pageable);

    @Query("select g from GrowthRecord g where g.petId = ?1 and g.recordMonth = ?2 and g.recordDay = ?3")
    List<GrowthRecord> findByPetIdAndRecordMonthAndRecordDay(long petId, Integer recordMonth, Integer recordDay);


}